Product : ISaGRAF V3
Date : 7-March-1996
File : Ethvxwks.Ethernet communication on VxWorks.htm
Subject : Ethernet communication on VxWorks
Keywords: Ethernet - VxWorks - IDK - recv function -
eth_lec_trame function - TATS0ETH.c
____________________________________________________________________
For VxWorks one thing has to be changed in file TATS0ETH.c:
the test on the return value of the function 'recv'
should be <= instead of <.
nb = recv....
...
if (nb <= 0) ...
The problem was found by somebody who made an NT command console program to
demonstrate the use of the ISaGRAF debug link.
If a graceful shutdown sequence on the socket is performed
then that port cannot be used again until the (vxWorks) ISaGRAF target is rebooted.
If an abortive (also known as 'hard') shutdown sequence is performed, then the port can be
re-used as normal.
The problem is caused by eth_lec_trame() (in tats0eth.c). When a socket is
closed gracefully, recv() returns 0 immediately, and will continue to do so
if called again. This causes a spin loop in eth_lec_trame(), with no means
of exit.
If the socket is closed using a hard shutdown, as performed by
the Workbench debugger, then recv() returns ERROR (-1), so the loop is
exited.
The problem can easily be corrected by changing the line
if (nb < 0 ) /* error or client socket closed (disconnected) */
to
if (nb <= 0 ) /* error or client socket closed (disconnected) */
Note that you must have the IDK (ISaGRAF Development Tool) to be
able to make this modification.
____________________________________________________________________
Copyright © 1996-2009 ICS Triplex ISaGRAF Inc. All rights reserved.